package com.esri.core.map;

import com.esri.core.internal.util.d;
import com.esri.core.renderer.Renderer;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class DrawingInfo implements Serializable {
    private static final String f = "showLabels";
    private static final String g = "scaleSymbols";
    private static final String h = "labelingInfo";
    private static final String i = "transparency";
    private static final String j = "renderer";
    private static final long serialVersionUID = 1;
    Renderer a;
    int b;
    LabelingInfo[] c;
    boolean d;
    boolean e;

    public DrawingInfo(Renderer renderer, int i2) {
        this.a = renderer;
        this.b = i2;
    }

    public DrawingInfo() {
    }

    public Renderer getRenderer() {
        return this.a;
    }

    public void setRenderer(Renderer renderer) {
        this.a = renderer;
    }

    public int getTransparency() {
        return this.b;
    }

    public void setTransparency(int i2) {
        this.b = i2;
    }

    public LabelingInfo[] getLabelingInfo() {
        return this.c;
    }

    public void setLabelingInfo(LabelingInfo[] labelingInfoArr) {
        this.c = labelingInfoArr;
    }

    public boolean getScaleSymbols() {
        return this.d;
    }

    public void setScaleSymbols(boolean z) {
        this.d = z;
    }

    public boolean getShowLabels() {
        return this.e;
    }

    public void setShowLabels(boolean z) {
        this.e = z;
    }

    public static DrawingInfo fromJson(JsonParser jsonParser) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        DrawingInfo drawingInfo = new DrawingInfo();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if (j.equals(currentName)) {
                drawingInfo.a = d.g(jsonParser);
            } else if (i.equals(currentName)) {
                drawingInfo.b = Integer.parseInt(jsonParser.getText());
            } else if (h.equals(currentName)) {
                ArrayList arrayList = new ArrayList();
                if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                    while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                        arrayList.add(LabelingInfo.fromJson(jsonParser));
                    }
                }
                drawingInfo.c = (LabelingInfo[]) arrayList.toArray(new LabelingInfo[0]);
            } else if (g.equals(currentName)) {
                drawingInfo.d = jsonParser.getBooleanValue();
            } else if (f.equals(currentName)) {
                drawingInfo.e = jsonParser.getBooleanValue();
            } else {
                jsonParser.skipChildren();
            }
        }
        return drawingInfo;
    }

    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        if (this.a != null) {
            a.writeFieldName(j);
            a.writeRawValue(this.a.toJson());
        }
        a.writeNumberField(i, this.b);
        a.writeBooleanField(g, this.d);
        a.writeBooleanField(f, this.e);
        if (this.c != null) {
            a.writeFieldName(h);
            a.writeStartArray();
            for (LabelingInfo labelingInfo : this.c) {
                a.writeRawValue(labelingInfo.toJson());
            }
            a.writeEndArray();
        }
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("DrawingInfo [renderer=");
        sb.append(this.a);
        sb.append(", transparency=");
        sb.append(this.b);
        sb.append(", labelingInfos=");
        LabelingInfo[] labelingInfoArr = this.c;
        sb.append(labelingInfoArr != null ? Arrays.asList(labelingInfoArr).subList(0, Math.min(this.c.length, 5)) : null);
        sb.append(", scaleSymbols=");
        sb.append(this.d);
        sb.append(", showLabels=");
        sb.append(this.e);
        sb.append("]");
        return sb.toString();
    }
}
